using UnityEngine;
using Voodoo.Sauce.Debugger;

namespace Voodoo.Sauce.Internal.DebugScreen
{
	public abstract class DebugToggleComponent : MonoBehaviour
	{
		private DebugToggleButton _button;

		protected DebugToggleButton Button
		{
			get
			{
				if (_button != null)
				{
					return _button;
				}
				_button = GetComponent<DebugToggleButton>();
				return _button;
			}
		}

		protected virtual void Start()
		{
			Button.SetValue(DefaultButtonState());
		}

		protected abstract bool DefaultButtonState();

		public virtual void SetEnabled(bool isEnabled)
		{
			Button.SetValue(isEnabled);
		}

		protected void UpdateEnabled()
		{
			Button.SetValue(DefaultButtonState());
		}
	}
}
